<!doctype html>
<html lang="en" class="fullscreen-bg">

<head>
	<title>鑫洋泉运营管理系统</title>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<!-- VENDOR CSS -->
	<link rel="stylesheet" href="assets/css/bootstrap.min.css">
	<link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.min.css">
	<link rel="stylesheet" href="assets/vendor/linearicons/style.css">
	<!-- MAIN CSS -->
	<link rel="stylesheet" href="assets/css/main.css">
	<!-- FOR DEMO PURPOSES ONLY. You should remove this in your project -->
	<link rel="stylesheet" href="assets/css/demo.css">
	<!-- GOOGLE FONTS -->
	<!-- <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700" rel="stylesheet"> -->
	<!-- ICONS -->
	<link rel="apple-touch-icon" sizes="76x76" href="assets/img/apple-icon.png">
	<link rel="icon" type="image/png" sizes="96x96" href="assets/img/favicon.png">
</head>

<body>
	<!-- WRAPPER -->
	<div id="wrapper">
		<div class="vertical-align-wrap">
			<div class="vertical-align-middle">
				<div class="auth-box ">
					<div class="left">
						<div class="overlay"></div>
						<div class="content text">
							<h1 class="heading"></h1>
							<p></p>
						</div>
					</div>
					<div class="right">
						<div class="content" style="width:80%">
							<div class="header">
								<!--<div class="logo text-center"><img src="" alt="Logo"></div>-->
								<p class="lead">鑫洋泉运营管理系统</p>
							</div>
							<form class="form-auth-small" id="form" action="page/index.html" mothed="post" onsubmit="return checkUser()">
								<div class="form-group">
									<!--<label for="signin-email" class="control-label sr-only">Email</label>-->
									<input class="form-control" id="username" name="name"  placeholder="用户名">
								</div>
								<div class="form-group">
									<!--<label for="signin-password" class="control-label sr-only">Password</label>-->
									<input type="password" class="form-control" id="password" name="pwd" placeholder="密码">
								</div>
								<div class="form-group clearfix">
									<label class="fancy-checkbox element-left">
										<input type="checkbox">
										<span>记住密码</span>
									</label>
								</div>
								<button  id="submit" type="submit" class="btn btn-primary btn-lg btn-block">登录</button>
								<div class="bottom">
									<!--<span class="helper-text"><i class="fa fa-lock"></i> <a href="#">Forgot password?</a></span> -->
 								</div>
							</form>
						</div>
					</div>
					<div class="clearfix"></div>
				</div>
			</div>
		</div>
	</div>
	<!-- END WRAPPER -->
	<script src="assets/vendor/jquery/jquery.min.js"></script>
	<script language="javascript" type="text/javascript">
		function checkUser() {
			var username = $("#username")[0].value;
			var password = $("#password")[0].value;
			if(username && password) {
				// if (username == "ivicarAdmin" && password == "admin" ) {
					// return true;
				// }
				// alert('请输入正确的用户名或密码')
				
			} else {
				alert('用户名或密码不能为空')
			}
			var data={};
			data.name=username;
			data.pwd = password;

			$.ajax(
                        {
                            url: "/oss-ws/ws/0.1/user/login",
                            // url: "../ws/0.1/vehicle",
                            // data: data,
                            type: "post",
                            contentType: "application/json; charset=utf-8",
                            dataType: "json",
							data:JSON.stringify(data),
                            beforeSend:function()
                            {
                                return true;
                            },
                            success:function(data)
                            {
                                if(data.code == 200)
								{
									var exp = new Date(); 
									exp.setTime(exp.getTime() + 60*60*1000);
									document.cookie="sessionId="+escape(data.dataObject);
									window.open('page/index.html', '_self')
								}
                                else
                                {
									alert(data.message);
                                    return false;
                                    
                                }
                            },
                            error: function()
                            {
                                alert('请求出错');
                            },
                            complete: function()
                            {
                            }
                        });
			
			return false;
		}
	</script>
</body>

</html>
